package com.lovely602.langchain4j.boot.controller.chat;


import com.lovely602.langchain4j.boot.service.ChatAssistant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 高阶，声明模式
 * @author lizhixing
 */
@RequestMapping(value = "/declarative")
@RestController
public class DeclarativeChatController {

    @Autowired
    private ChatAssistant chatAssistant;


    /**
     * 声明式聊天
     */
    @RequestMapping(value = "/chat")
    public String chat(@RequestParam(value = "msg", defaultValue = "hello", required = true) String msg) {
        return chatAssistant.chat(msg);
    }

}
